import { Component } from '@angular/core';
import { IonicPage,ModalController, NavController, NavParams } from 'ionic-angular';
import {Storage} from '@ionic/storage';
import { TabsPage } from '../tabs/tabs';
import { LoginPage } from '../login/login';
/**
 * Generated class for the WelcomePage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-welcome',
  templateUrl: 'welcome.html',
})
export class WelcomePage {
  isLogin:boolean;
  slides = [



  ];


  constructor(
    public navCtrl: NavController,
    public navParams: NavParams,
    private storage: Storage,
    public modalCtrl: ModalController,



  ) {
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad WelcomePage');
  }
  toHome(){
    let that = this;
    this.storage.ready().then(() =>{
      this.storage.get('user').then((val) =>{
        console.log(val);
        if(val){
          // const modelPage=that.modalCtrl.create(TabsPage);

          this.navCtrl.push(TabsPage);
        }else{
          // const modelPage=that.modalCtrl.create(LoginPage);

          this.navCtrl.push(LoginPage);
        }
      })
    })

  }
}
